function populate_select(element) {
  var selectElement = $("select", element);
  var url, rootElement = "";

  switch (selectElement.attr("class")) {
      case "dd_event_category":
        url = dasding.config.eventCategoryList;
        rootElement = "eventCategory";
        break;
  }

  $.getJSON(url, function(data){
      var options, tooltips = '';
      console.log(data["eventCategory"].length);
      $.each(data["eventCategory"], function(index, value) {
          options += "<option value='" + value.id + "'>" + value.name + "</option>";
          tooltips += "<span class='dd_tooltip' id='tooltip" + value.id + "'>" 
            + value.description + "</span>";
      });

      selectElement.append(options);
      selectElement.parent().find('.dd_select_tooltip').append(tooltips);

      selectElement.bind("change", function(event) {
        $(".dd_tooltip").css("display", "none");
        $("#tooltip" + event.currentTarget.value).css("display", "block");
      })

  });

}


function formatDate(inputdate) {
  var dateString = "01.01.1970";
// var tempArray = inputdate.split("T");
// var tempDate = new Date(tempArray[0]);
// dateString = tempDate.getDate() + "." + tempDate.getMonth() + "." + tempDate.getFullYear();

// var tempTime = new Date(tempArray[1]);
// console.log(tempArray);
  return dateString;
}
function formatTime(inputdate) {
  var dateString = "12:33";
  // var tempArray = inputdate.split("T");
  // var tempDate = new Date(tempArray[0]);
  // dateString = tempDate.getDate() + "." + tempDate.getMonth() + "." + tempDate.getFullYear();

  // var tempTime = new Date(tempArray[1]);
  // console.log(tempArray);
  return dateString;
}

$.urlParam = function(name){
    var results = new RegExp('[\\?&amp;]' + name + '=([^&amp;#]*)').exec(window.location.href);
    if (results) return results[1] || 0;
    else 0;
}